package com.jjb.www.ui.activity;

import android.text.Html;

import com.hjq.http.EasyHttp;
import com.hjq.http.listener.HttpCallback;
import com.hjq.shape.view.ShapeTextView;
import com.jjb.www.R;
import com.jjb.www.app.AppActivity;
import com.jjb.www.http.api.AboutCommonProblemApi;
import com.jjb.www.http.api.ReplyApi;
import com.jjb.www.http.model.HttpData;
import com.jjb.www.widget.BrowserView;

/**
 *    author : Android CRG
 *    github : https://github.com/getActivity/AndroidProject
 *    time   : 2019/03/01
 *    desc   : 常见问题
 */
public class ProblemActivity extends AppActivity {

    private ShapeTextView mTvContent;



    @Override
    protected int getLayoutId() {
        return R.layout.activity_problem;
    }

    @Override
    protected void initView() {
        mTvContent = findViewById(R.id.tv_content);
    }

    @Override
    protected void initData() {
        getData();
    }

    private void getData() {
        EasyHttp.get(this)
                .api(new AboutCommonProblemApi()
                        )
                .request(new HttpCallback<HttpData<AboutCommonProblemApi.Bean>>(this) {

                    @Override
                    public void onSucceed(HttpData<AboutCommonProblemApi.Bean> data) {
                        mTvContent.setText(Html.fromHtml(data.getData().getContent()));
//                        mTvContent.getSettings().setDefaultTextEncodingName("utf-8");
//
//                        mTvContent.loadDataWithBaseURL(null, data.getContent(), "text/html", "utf-8", null);
                    }

                });
    }
}